package fatworm.query;

import fatworm.query.constant.Constant;

public class ExtendScan implements Scan {

	private Scan s;
	private String oldname, newname;
	
	public ExtendScan(Scan s, String oldname, String newname) {
		this.s = s;
		this.oldname = oldname;
		this.newname = newname;
	}
	
	public void beforeFirst() {
		s.beforeFirst();
	}
	
	public boolean next() {
		return s.next();
	}
	
	public void close() {
		s.close();
	}
	
	public Constant getVal(String name) {
		if (newname.equals(name))
			return s.getVal(oldname);
		else
			return s.getVal(name);
	}
	
/*	public int getInt(String name) {
		if (newname.equals(name))
			return s.getInt(oldname);
		else
			return s.getInt(name);
	}
	
	public String getString(String name) {
		if (newname.equals(name))
			return s.getString(oldname);
		else
			return s.getString(name);
	}*/
	
	public boolean hasField(String name) {
		if (newname.equals(name))
			return true;
		else
			return s.hasField(name);
	}
}